<!DOCTYPE html>
<html>

<head>
	<title>我的资料</title>
	<meta charset="utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
	<link rel="stylesheet" href="/js/bootstrap/css/bootstrap.min.css">
	<script src="/js/jquery/jquery.min.js"></script>
	<link rel="stylesheet" href="/css/font/css/font-awesome.min.css" />
	<script src="/js/plugins/jrender/jrender.min.js"></script>
    <script src="/js/plugins/dialog2/dialog.min.js"></script>
	<link rel="stylesheet" href="/css/reset.css" />
	<link rel="stylesheet" href="/css/myProfiles.css" />
    <link rel="stylesheet" href="/js/plugins/dialog2/dialog.css">
	<script src="/js/common.js"></script>

	<script>
        //取出共享的数据
        var id = getParams().id; 				//群id
        var userId = JSON.parse(sessionStorage.getItem("user")).id;      //用户id
		$(function () {
            console.log(id);

            // 将数据设置到数据中
            // $.get('/users/' + id,function (data) {
            //     console.log(data);
            //     $('.info').renderValues(data);
            //     sessionStorage.setItem("stranger",JSON.stringify(data));
            // });
            $.get('/friends/crowds/' + id,function (data) {
                console.log(data);
                $('#crowdTitle').renderValues(data);
            })

			$.get('/friends/crowds/users/' + id,function (data) {
				$('.link-box').renderValues({list:data},{
                    get_href:function (item, value) {
                        $(item).attr('href',$(item).data('href') + value);
                    }
				})
            })
			
			$.get('/messages/crowds/' + id + "/" + userId,function (data) {
                console.log(data[0].content);
                $('#message').text(data[0].content);
            });

			$('.enterCrowdBtn').click(function () {
				$.post('/friends/crowdRelation',{crowdId:id,userId:userId},function (data) {
					if(data.success){
                        $(document).dialog({
                            style:"IOS",
                            titleShow: false,
                            autoClose: 2000,
                            content: '成功加入该群'
                        });
					}else{
                        $(document).dialog({
                            style:"IOS",
                            titleShow: false,
                            autoClose: 2000,
                            content: data.msg
                        });
					}
                })
            })

        });

        function batchMarkread() {
            $.ajax({
                type: "PUT",
                url: "/messages/batchMarkread",
                data: {"userId":id,"targetId":userId,type:4},
                success: function(data){

                }
            });
        }
        batchMarkread();

	</script>

</head>

<body>
	<div class="nav-search">
			<a href="javascript:window.history.go(-1);">
				<span><i class="fa fa-angle-left fa-2x" ></i></span>
			</a>
	</div>
	<hr/>
<div class="container">
	<div class="row info">
		<div class="col-2" style="margin-right: 0px;">
		</div>
		<div class="col-8" id="crowdTitle">
			<h5 render-html="name"></h5>
			<ul class="list-inline">
				<li class="list-inline-item"><small render-html="billboard"></small></li>
			</ul>
		</div>
	</div>



</div>

<hr />

<div class="row link-box">
	<ul class="mainmenu" render-loop="list">
		<li><a data-href="/friend/profiles.html?id=" render-fun="get_href" render-key="list.id"><b><img render-src="list.headImgUrl" width="50px"></b><span render-html="list.nickName"></span></a></li>
	</ul>

</div>
<hr />
    <div class="container info">
        <label>信息:</label><b></b><textarea class="form-control" rows="5" id="message"></textarea>
    </div>
	<!--个人资料的跳转页面-->
	<div class="d-flex setting" >
		<div class="p-2 flex-fill" style="text-align: center">
			<a href="/mine/editTravels.html">
				<button class="btn sendMassageBtn" data-type="4">
					拒绝邀请</button>
			</a>
		</div>
		<div class="p-2 flex-fill" style="text-align: center">
			<a href="javascript:;"><button class="btn enterCrowdBtn" data-type="4">同意邀请</button>
			</a>
		</div>
	</div>



<!--<ul class="mainmenu">
	<li><a href="#" ><b><i class="fa fa-star fa-2x"></i></b><span>我的收藏</span></a></li>
	<li><a href="#" ><b><i class="fa fa-commenting-o fa-2x"></i></b><span>我的评论</span></a></li>

	<li><a href="#" ><b><i class="fa fa-list-ul fa-2x"></i></b><span>我的心愿单</span></a></li>
	<li><a href="#" ><b><i class="fa fa-bullhorn fa-2x"></i></b><span>我的消息</span></a></li>
	<li><a href="#" ><b><i class="fa fa-file-text fa-2x"></i></b><span>我的订单</span></a></li>
	<li><a href="#" ><b><i class="fa fa-briefcase fa-2x"></i></b><span>我的钱包</span></a></li>
</ul>-->

</body>

</html>